using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SIGModeMainExecutor : MonoBehaviour
{
    public RespawnPoint _entranceTeamEscort;
    public List<RespawnPoint> _respawnPointTeamEscort;
    private List<RespawnPoint> _landingZoneTeamAmbush;
    private List<ISIGPlayer> _player;
    private int _readyCounter;
    private List<ISIGPlayer> _teamEscort;
    private List<ISIGPlayer> _teamAmbush;

    private void Update()
    {
        if (_readyCounter == 10)//counts of total player in this match
        {
            ModeEnable();
        }
        WinCheck();
    }

    public void PlayerReady()
    {
        _readyCounter++;
    }

    public void PlayerReadyCancled()
    {
        _readyCounter--;
    }

    public void ModeEnable()
    {
        _entranceTeamEscort.gameObject.SetActive(true);
        foreach (RespawnPoint RespawnPoint in _landingZoneTeamAmbush)
        {
            RespawnPoint.gameObject.SetActive(true);
        }
        AssignTeam();
        //some game start function
    }

    public void ModeDisable()
    {
        //some game end function
    }

    private void AssignTeam()
    {
        foreach (ISIGPlayer sigPlayer in _player)
        {
            // function to assign team
            sigPlayer.AssignTeam(true);
        }
    }

    public void Communicate(int messageNum, bool _isTeamEscort)
    {
        //broadcast message to team mates
    }

    public void Respawn(Vector3 respawnPosition, ISIGPlayer player) { }

    public void Land(Vector3 landZonePosition, ISIGPlayer player) { }

    public void WinCheck()
    {
        //if time runs out without message package in the destination, team-ambush wins
        //if message package reaches the destination before time runs out, team-escort wins
    }
}
